//
//  ShoppingCartViewController.m
//  DuBai
//
//  Created by darktm on 14-2-23.
//  Copyright (c) 2014年 darktm. All rights reserved.
//

#import "ShareCommodityViewController.h"

#import "ShareCommodityViewCell.h"

@interface ShareCommodityViewController ()

@end

@implementation ShareCommodityViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    
    self.share.layer.cornerRadius = 13.0f;
    self.share.layer.masksToBounds = YES;
    
    
    [self.allBtn setTitleColor:[UIColor brownColor] forState:UIControlStateSelected];
    [self.allBtn setTitleColor:[UIColor brownColor] forState:UIControlStateHighlighted];
    [self.allBtn setSelected:YES];
    
    
    [self.myBtn setTitleColor:[UIColor brownColor] forState:UIControlStateSelected];
    [self.myBtn setTitleColor:[UIColor brownColor] forState:UIControlStateHighlighted];
}

#pragma mark - tableview delegate -

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    ShareCommodityViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ShareCommodityViewCell" forIndexPath:indexPath];
    
    return cell;
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)on_btn_all:(id)sender {
    
    if(self.allBtn.selected) return;
    
    [self.allBtn setSelected:YES];
    [self.myBtn setSelected:NO];
    
    
    [UIView animateWithDuration:.2 delay:0 options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionBeginFromCurrentState animations:^{
        CGRect frame = self.prompt.frame;
        frame.origin.x -= 160;
        self.prompt.frame = frame;
    } completion:NULL];
    
}

- (IBAction)on_btn_my:(id)sender {
    
    if(self.myBtn.selected) return;
    
    [self.allBtn setSelected:NO];
    [self.myBtn setSelected:YES];
    
    [UIView animateWithDuration:.2 delay:0 options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionBeginFromCurrentState animations:^{
        CGRect frame = self.prompt.frame;
        frame.origin.x += 160;
        self.prompt.frame = frame;
    } completion:NULL];
}
@end
